package com.atguigu.service.impl;

import com.atguigu.dao.UserDao;
import com.atguigu.domain.User;
import com.atguigu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * UserServiceImpl
 *
 * @Author: 马伟奇
 * @CreateTime: 2021-03-03
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    /**
     * jdk 1.8新推出的特性Optional，解决空指针的问题
     * @param id
     * @return
     */
    @Override
    public User findUserById(Integer id) {

        return userDao.findById(id).get();
    }
}